package com.bite.SumIsS;

public class Demo {
    public int[] twoSum(int[] price, int target) {
        int left = 0;
        int right = price.length - 1;
        while (left < right) {
            if (price[left] + price[right] > target) {
                right--;
            } else if (price[left] + price[right] < target){
                left++;
            } else {
                return new int[] {price[left],price[right]};
            }
        }
        return new int[]{0};
    }
}
